今天閱讀「適用於 Android 開發人員的 Jetpack Compose」第二章「版面配置、主題設定和動畫」的「讓應用程式脫穎而出的 5 個快速動畫」
AnimatedVisibility
來自動增加動畫
AnimatedVisibility(showDrtails) {
Text(
message.timestamp
)
}
modifier
中增加animateContentSize
Text(
modifier = Modifier
.animateContentSize()
)
animateContentSize
還能增加動畫樣式
Text(
modifier = Modifier
.animateContentSize(animationSpec = spring(
dampingRatio = Spring.DampingRatioLowBouncy,
stiffness = Spring.StiffnessLow
)
)
)
AnimatedContent
animateFloatAsState
val progress by animateFloatAsState(
targetValue = ...
)
drawBehind
Image(
modifier = Modifier.drawBehind {
drawCircle {
rotate (rotationAnimation.value) {
drawCircle (...)
}
}
}
)